$(function(){
    // 背景变白
    $("#search1,#search2").blur(function(){
        $(".fknAV").css("opacity","0");
        
    });
    $("#search1,#search2").click(function(){
        $(".fknAV").css("opacity","0.9");
        $(".fknAV").css("z-index","100");
    })
    // 中间出现搜索表单
    
    $("#search2form").mouseenter(function(){
        $("#search2form").css("display","block");
    });

    $("#search2").click(function(){
        $("#search1form").css("display","none");
        $("#search2form").css("display","block");
    });
    $("#search1form").mouseenter(function(){
        $("#search1form").css("display","block");
    });

    $("#search1").click(function(){
        $("#search2form").css("display","none");
        $("#search1form").css("display","block");
    });
    $("#outer").click(function(){
        $("#search1form").css("display","none");
        $("#search2form").css("display","none");
        $(".fknAV").css("z-index","-1");
    })
})
// 左右滚动
$(function(){
    let width = 0;
    for (let i = 0; i < $('.nav_item').length; i++) {
        width += $('.nav_item').eq(i).outerWidth(true);
    }
    $('.nav_mine').width(width+20);  //width只是内容的宽度，需要加上padding的宽度
});

// 点赞推荐
for(let i = 0; i < $("#likes").children().length; i++){
    //没有点赞时候
    $("#likes").children(i).children(0).click(function(){
        $(this).css("z-index","10");
        $(this).next().css("z-index","11");
    });
}
for(let i = 0; i < $("#likes").children().length; i++){

    $("#likes").children(i).children(1).click(function(){
        $(this).css("z-index","8");
        $(this).prev().css("z-index","11");
    });
}
// 午餐点赞
for(let i = 0; i < $("#likel").children().length; i++){
    //没有点赞时候
    $("#likel").children(i).children(0).click(function(){
        $(this).css("z-index","10");
        $(this).next().css("z-index","11");
    });
}
for(let i = 0; i < $("#likel").children().length; i++){
    $("#likel").children(i).children(1).click(function(){
        $(this).css("z-index","8");
        $(this).prev().css("z-index","11");
    });
}
//晚餐点赞
for(let i = 0; i < $("#liken").children().length; i++){
    //没有点赞时候
    $("#liken").children(i).children(0).click(function(){
        $(this).css("z-index","10");
        $(this).next().css("z-index","11");
    });
}
for(let i = 0; i < $("#liken").children().length; i++){

    $("#liken").children(i).children(1).click(function(){
        $(this).css("z-index","8");
        $(this).prev().css("z-index","11");
    });
    
}

for(let i = 0; i < $("#likee").children().length; i++){
    $("#likee").children(i).children(0).children(0).click(function(){
        $(this).css("z-index","10");
        $(this).next().css("z-index","11");
    });
}
for(let i = 0; i < $("#likee").children().length; i++){
    $("#likee").children(i).children(0).children(1).click(function(){
        $(this).css("z-index","8");
        $(this).prev().css("z-index","11");
    });
    
}